package com.ssu.sslab.sensorInfo;


import com.ssu.sslab.restriction.DataType;
import com.ssu.sslab.restriction.InfoType;

public class SensorsInfo implements DataType{
	
	
	
	private int sensorID;
	private String sensorName;
	private InfoType  valueType;
	private Object  value;
	private String description; //
	
//	private String sensorIP;
//	private String date;
	
	public SensorsInfo(){
		
	}

	public SensorsInfo(int sensorID,String sensorName,InfoType valueType,Object  value,String description){
		
		this.sensorID = sensorID;
		
		//Set the sensorName to 8 bytes String.
		String sensor = "";
		if (sensorName.length() > 0 && sensorName.length() <= 8) {
			for(int i = 0; i < 8-sensorName.length();i++)
			{
				sensor += " ";
			}
			this.sensorName = sensorName+sensor;
		}else {
			this.sensorName = sensorName.substring(0, 8);
		}
		this.sensorName = sensorName;
		this.valueType = valueType;
		this.value = value;
		
		//Set the sensor description to 10 bytes String.
		String des = "";
		if (description.length() > 0 && description.length() <= 10) {
			for (int i = 0; i < 10 - description.length(); i++) {
				des += " ";
			}
			this.description = description + des;
		} else {
			this.description = description.substring(0, 10);
		}
		
		this.description = description;
	}

	public void setSensorID(int sensorID) {
	}

	public String getSensorName() {
		return sensorName;
	}

	public void setSensorName(String sensorName) {
		this.sensorName = sensorName;
	}

	public InfoType getValueType() {
		return valueType;
	}

//	public String getSensorIP() {
//		return sensorIP;
//	}
//
//	public void setSensorIP(String sensorIP) {
//		this.sensorIP = sensorIP;
//	}

//	public String getDate() {
//		return date;
//	}
//
//	public void setDate(String date) {
//		this.date = date;
//	}

	public int getSensorID() {
		return sensorID;
	}

	public void setValueType(InfoType valueType) {
		this.valueType = valueType;
	}


	public Object getValue() {
		return value;
	}

	public void setValue(DataType value) {
		this.value = value;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return super.toString();
	}
	
	
}
